import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/login', component: () => import('@/views/login/LoginPage.vue') },
    {
      path: '/',
      component: () => import('@/views/layout/LayoutContainer.vue'),
      redirect: '/home', // 修改默认重定向到首页
      children: [
        {
          path: '/home',
          component: () => import('@/views/Home.vue'),
          meta: {
            title: 'home',
            breadcrumb: true,
          },
        },
        {
          path: '/art-cate',
          component: () => import('@/views/article/ArtCate.vue'),
          meta: {
            title: 'art-cate',
            breadcrumb: true,
          },
        },
        {
          path: '/art-list',
          component: () => import('@/views/article/ArtList.vue'),
          meta: {
            title: 'art-cate',
            breadcrumb: true,
          },
        },
        {
          path: '/user-info',
          component: () => import('@/views/user/UserInfo.vue'),
          meta: {
            title: 'art-list',
            breadcrumb: true,
          },
        },
        {
          path: '/user-avatar',
          component: () => import('@/views/user/UserAvatar.vue'),
          meta: {
            title: 'user-avatar',
            breadcrumb: true,
          },
        },
        {
          path: '/user-pwd',
          component: () => import('@/views/user/UserPwd.vue'),
          meta: {
            title: 'user-pwd',
            breadcrumb: true,
          },
        },
      ],
    },
  ],
})

export default router
